Storage device employing a flash memory

ABSTRACT

A semiconductor disk wherein a flash memory into which data is rewritten in block unit is employed as a storage medium, the semiconductor disk including a data memory in which file data are stored, a substitutive memory which substitutes for blocks of errors in the data memory, an error memory in which error information of the data memory are stored, and a memory controller which reads data out of, writes data into and erases data from the data memory, the substitutive memory and the error memory. Since the write errors of the flash memory can be remedied, the service life of the semiconductor disk can be increased.

The present application is a continuation of application Ser. No.11/599,308, filed Nov. 15, 2006; which is a continuation of applicationSer. No. 11/085,507, filed Mar. 22, 2005, now U.S. Pat. No. 7,154,805;which is a continuation of U.S. application Ser. No. 10/847,917, filedMay 19, 2004, now U.S. Pat. No. 6,925,012; which in turn, is acontinuation of U.S. application Ser. No. 10/409,080, filed Apr. 9,2003, now U.S. Pat. No. 6,788,609, which, in turn, is a continuation ofU.S. application Ser. No. 10/046,413, filed Jan. 16, 2002, now U.S. Pat.No. 6,567,334, which, in turn, is a continuation of U.S. applicationSer. No. 09/866,622, filed May 30, 2001, now U.S. Pat. No. 6,347,051,which, in turn, is a continuation of U.S. application Ser. No.09/660,648, filed Sep. 12, 2000, now U.S. Pat. No. 6,341,085, which, inturn, is a continuation of U.S. application Ser. No. 08/782,344, filedJan. 13, 1997, now U.S. Pat. No. 6,130,837, and which, in turn, is acontinuation of U.S. application Ser. No. 07/981,438, filed Nov. 25,1992, now U.S. Pat. No. 5,644,539; and the entire disclosures of whichare incorporated herein by reference.

BACKGROUND OF THE INVENTION

The present invention relates to a storage device employing a flashmemory. More particularly, it relates to a method of extending theservice life of such a storage device.

A magnetic storage device is the most commonly used prior-art auxiliarystorage for information equipment. With the magnetic storage device, afile to be written thereinto is divided into a data storing unit calleda “sector”, and it is stored in correspondence with the physicalposition of a storage medium. That is, in rewriting a certain file, thedata of the file are written into basically the same position. Herein,when the quantity of data to be written has increased, new sectors areused for the increased data. Also, an optical disk storage device ismentioned as another auxiliary storage. The optical disk storage devicewhich is conventional in the art at present can write data thereintoonly once, and cannot erase data therefrom. In rewriting a file writtenonce, accordingly, an actual rewriting operation is not performed, butthe data of the file are written into a different part of the storagearea. The data of the file written before are invalidated so as not tobe read out thenceforth. That is, unlike the magnetic disk storagedevice, the optical disk storage device fulfills the function of theauxiliary storage in accordance with the scheme that the rewritten dataand the locations thereof are not correlated at all.

In recent years, a semiconductor file storage device has been designatedfor use as an auxiliary storage, which employs a semiconductor memory incontrast to the above storage devices in each of which a disk is rotatedto access the data of large capacity at high speed. In particular, adevice employing a nonvolatile memory which is electrically rewritable(hereinbelow, expressed as the “EEPROM” short for electrically erasableand programmable read-only memory) will form the mainstream of thesemiconductor file storage device in the future.

A technique which concerns the storage device employing the EEPROM isdisclosed in the official gazette of Japanese Patent ApplicationLaid-open No. 25798/1991. This technique is intended to realize apractical storage device by the use of the EEPROM in spite of thedrawback of the EEPROM which limits the number of rewriting eraseoperations. To sum up, a plurality of memory elements (EEPROM elements)are prepared, and the number of rewriting erase operations of theindividual elements are recorded and managed. When one of the memoryelements has reached a prescribed number of operations below theguaranteed number of rewrite operations of the EEPROM, it ischanged-over to another memory element, which is then used for storingdata. Thus, the stored data are protected.

The prior-art storage devices mentioned above will be discussed further.

According to the scheme of the optical disk storage device, each timethe file is rewritten, the part of the storage area correspondingthereto is ruined. This incurs the problem that a satisfactory storagearea cannot be secured without a storage medium having a very largecapacity. Especially in the case of the storage device of theinformation equipment in which the files are frequently rewritten, therequired storage area increases even when the actual capacity forstoring the data of the files is not very large.

On the other hand, with the magnetic disk storage device which is themost commonly used as the auxiliary storage, when the file written onceis to be rewritten, advantageously the new data are written into thesame part of a storage area. In the application of such a rewritingoperation to the EEPROM, however, a file (usually called “directoryfile”) for listing the stored data files, a file (“file allocationtable”) for referring to the locations of the data files, etc. need tobe rerecorded at each access for writing data, so that the rewritingoperations concentrate locally. As a result, the EEPROM which has alimited number of writing erase operations has its service lifeshortened drastically.

The technique utilizing the EEPROM as disclosed in the official gazetteof Japanese Patent Application Laid-open No. 25798/1991, consists of thescheme whereby the deteriorated state of the memory element is graspedin terms of the number of erase operations, whereupon the memory elementis changed-over to the substitutive memory element before being ruined.This scheme necessitates a memory capacity which is, at least, doublethe actual capacity for storing the data of files. That is, thesubstitutive memory element is not used at all until the memory elementused first is ruined. Besides, the ruined memory element is then quiteunnecessary. These conditions render the physical volume and weight ofthe storage device very wasteful. Moreover, since all the data of thememory element are not usually rewritten, it is uneconomical that thememory chip having been only partly deteriorated is entirely broughtinto the state of nonuse.

It is accordingly desired to realize a semiconductor file storage devicewhich has a longer service life and which is smaller in size and moreeconomical.

Meanwhile, a DRAM (dynamic random access memory) or an SRAM (staticrandom access-memory) has been employed as the storage medium of asemiconductor disk storage device. Also, a flash memory has been knownas one sort of EEPROM.

With the flash memory, data can be read therefrom in small data units,such as in bytes or word units, as in the case of the DRAM or the SRAM.Since, however, the flash memory is limited in the number of rewriteoperations, data are written thereinto by reducing the number of rewriteoperations in such a way that a rewriting unit is set at a block unitsuch as of 512 bytes.

Also, it is structurally required of the flash memory to erase databefore the rewriting operation. Therefore, some flash memory devices areendowed with the command process functions of “erase” etc.

Anyway, the limited number of rewrite operations is the most seriousproblem in the case where the flash memory is employed as the storagemedium of a semiconductor disk storage device. Since a directory areaand an FAT (file allocation table) area, for example, are rewritten morefrequently than the other areas, only the specified blocks of the flashmemory for the directory and FAT areas are more liable to exceed thelimit of rewrite operations of the flash memory. Consequently, the wholesemiconductor disk becomes unusable due to the abnormalities of only thespecified blocks, and the semiconductor disk is of low reliability onaccount of the short service life thereof.

It is accordingly desired to realize a semiconductor disk storage devicewhich has a longer service life.

SUMMARY OF THE INVENTION

An object of the present invention is to provide a storage deviceemploying a flash memory, which has a longer service life and which issmaller in size and more economical then conventional storage devices.

Another object of the present invention is to extend the service life ofa semiconductor disk storage device employing a flash memory.

In one aspect of performance of the present invention, a storage deviceemploying a flash memory comprises a storage area which is divided intophysical areas that are identified by physical area identificationinformation; logical area conversion means supplied with logical areaidentification information being virtual identification information inan operation of writing data, for converting the logical areaidentification information into the physical area identificationinformation corresponding thereto in the case of writing the data into alogical area; and a memory controller which receives the physical areaidentification information resulting from the conversion, and whichwrites the data into the physical area; the logical area conversionmeans being capable of converting the identical logical areaidentification information into the plurality of items of physical areaidentification information.

In operation, when the physical area into which the data is to bewritten is normal, the memory controller writes the data into thisphysical area. On the other hand, when the physical area is abnormal,the memory controller writes the data into another of the physical areasbased on the logical area identification information.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram showing a semiconductor disk storage deviceand a host system in the first embodiment of the present invention;

FIG. 2 is a diagram for explaining the memory map of an error memorywhich is included in the semiconductor disk storage device of the firstembodiment;

FIG. 3 is a flow chart of a read process which is executed by amicrocomputer in the first embodiment;

FIG. 4 is a flow chart of a write process which is executed by themicrocomputer in the first embodiment;

FIG. 5 is a flow chart of an error process which is executed by themicrocomputer in the first embodiment;

FIG. 6 is a block diagram showing a semiconductor disk storage deviceand a host system in the second embodiment of the present invention;

FIG. 7 is a diagram for explaining the memory map of a data memory whichis included in the semiconductor disk storage device of the secondembodiment;

FIG. 8 is a flow chart of a read procedure which is executed by amicrocomputer in the second embodiment;

FIG. 9 is a flow chart of a write procedure which is executed by themicrocomputer in the second embodiment;

FIG. 10 is a diagram showing the hardware architecture of the thirdembodiment of the present invention;

FIG. 11 is a diagram showing the storage configuration of a flash memorychip which is included in the third embodiment;

FIG. 12 is a flow chart of a main routine showing the operation of thethird embodiment;

FIG. 13 is a flow chart of an erase management routine showing the erasemanagement operation of the third embodiment;

FIG. 14 is a diagram showing the hardware architecture of the fourthembodiment of the present invention;

FIG. 15 is a diagram showing the storage configuration of a flash memorychip which is included in the fourth embodiment;

FIG. 16 is a flow chart of a main routine showing the operation of thefourth embodiment;

FIG. 17 is a flow chart of an arrangement routine showing the sectorarrangement operation of the fourth embodiment;

FIG. 18 is a flow chart of an erase management routine showing the erasemanagement operation of the fourth embodiment;

FIG. 19 is a diagram showing the storage configuration of a flash memorychip which is included in the fifth embodiment of the present invention;

FIG. 20 is a diagram showing the hardware architecture of the fifthembodiment;

FIG. 21 is a flow chart of an erase management routine showing the erasemanagement operation of the fifth embodiment;

FIG. 22 is a diagram showing the hardware architecture of the sixthembodiment of the present invention;

FIG. 23 is a diagram showing the configuration of a flash memory chipwhich is furnished with a table for every erase block;

FIG. 24 is a diagram showing the configuration of a flash memory chipwhich is furnished with an information storing area separately from dataareas; and

FIG. 25 is a diagram showing the configuration of a flash memory chipwhich is furnished with a buffer area separately from data areas.

PREFERRED EMBODIMENTS OF THE INVENTION

FIG. 1 is a block diagram of the first embodiment of the presentinvention. Referring to the figure, numeral 1 indicates a semiconductordisk storage device, which is connected to the host bus 3 of a hostsystem 2. The semiconductor disk storage device 1 comprises amicrocomputer 4 (functioning as logical area conversion means,instruction acceptance means and instruction conversion means), a memorycontroller 5, a buffer memory 6, an error memory 7 and a data memory 8.The buffer memory 6 is a memory in which data to be written into thedata memory 8 and the error memory 7 or data read out of them aretemporarily stored, and which is constructed of an SRAM which simplifiesdata fetching and latching operations. The data memory 8 is constructedof sixteen flash memory elements of 2 MB each. Accordingly, the storagecapacity of the semiconductor disk storage device 1 is 32 MB. The errormemory 7 is constructed of a flash memory element of 512 KB, and itstores therein the error information of the data memory 8 and the dataof the blocks of the data memory 8 undergoing errors. Both the datamemory 8 and the error memory 7 have data written thereinto in blockunits of 512 bytes. The microcomputer 4 receives an instruction from thehost bus 3, and controls the memory controller 5 in accordance with theinstruction. The memory controller 5 controls the read and writeoperations of the buffer memory 6, error memory 7 and data memory 8 bythe use of addresses 9, data 10 and control signals 11. In addition,since the error memory 7 and the data memory 8 require erase operations,the memory controller 5 controls the erase operations.

FIG. 2 illustrates an example of the memory map of the error memory 7.The memory map consists of the three areas of an error information area71, a usage information area 72 and a substitutive memory area 73. Theseareas need to be separated in agreement with the boundaries of datawriting blocks. The error information area 71 is the area in which theerror information corresponding to the individual blocks of the datamemory 8 are stored. When the block is normal, the error information isdenoted by FFFFh, and when the block is abnormal, the error informationindicates the number of the block of the substitutive memory area 73substituting for the abnormal block. The usage information area 72 isthe area which expresses the usage situation of the substitutive memoryarea 73, and in which usage information corresponding to the individualsubstitutive blocks of the substitutive memory area 73 are stored. Asthe usage information, one bit is allotted to each of the substitutiveblocks. When the corresponding substitutive block is used or occupied asthe substitute, the usage information is denoted by “1”, and when not,the usage information is denoted by “0”. The unused or unoccupied blockof the substitutive memory area 73 can be found by seeking the bit of“0” in the usage information area 72. The substitutive memory area 73 isthe area which substitutes for the error blocks of the data memory 8. Itis configured of the same 512-byte blocks as those of the data memory 8,and the respective blocks are endowed with the Nos. of the substitutiveblocks successively from an address 20000h.

Now, the operation of the semiconductor disk storage device 1 in thisembodiment will be explained. It is first assumed that an instructionfor reading out file data has been received from the host bus 3. In thiscase, the microcomputer 4 processes the instruction, but the controlcontents thereof differ depending upon the ways in which the instructionis given. For example, in a case where the allocation information of thefile data to be read out is afforded in terms of a sector number or atrack number as in a magnetic disk storage device etc., the sector ortrack number needs to be converted into the physical address of the datamemory 8. In this embodiment, for the sake of brevity, the allocationinformation from the host bus 3 is assumed to be the block number of thedata memory 8. The block number corresponds to the upper bits of thephysical address. FIG. 3 illustrates the processing steps of a readprocess in the case where the microcomputer 4 functions as the logicalarea conversion means. At the step 100, the error information of theblock number delivered from the host bus 3 is fetched from the errorinformation area 71 of the error memory 7. By way of example, in thecase of reading out the data of block #1, the error information of theaddress 00002h of the error memory 7 is fetched, and in the case ofreading out the data of block #2, the error information of the address00004h is fetched. At the next step 101, whether or not the pertinentblock is normal is checked in view of the fetched error information. Inthe case of the block #1, the error information is “FFFFh”, so 10 thatthe block #1 is found to be normal. In contrast, in the case of theblock 12, the error information is “0000h”, so that the block #2 isfound to be abnormal. When the pertinent block is normal, as is theblock #1, the data of 512 bytes are fetched from the block #1 of thedata memory 8 and then transferred to the host bus 3 at the step 102. Onthe other hand, when the pertinent block is abnormal, as with the block12, the data of 512 bytes are fetched from the substitutive block #0 ofthe substitutive memory area 73 indicated by the error information“0000h” and then transferred to the host bus 3 at the step 103. Here,the fetch of the information from the error memory 7, the fetch of thedata from the data memory 8 and the transfer of the data to the host bus3 are affected under the control of the microcomputer 4 by the memorycontroller 5. In this manner, in the operation of reading out the filedata, the error information is fetched before reading out the desiredblock, thereby checking if the pertinent block is normal. In the case ofthe normal block, the block of the data memory 8 is read out, whereas inthe case of the abnormal block, the substitutive block of thesubstitutive memory area 73 is read out.

Next, let's consider a case where an instruction for writing file datahas been received from the host bus 3. FIG. 4 illustrates the processingsteps of a write process which is executed by the microcomputer 4. Atthe step 200, the microcomputer 4 supplies the buffer memory 6 with thefile data delivered from the host bus 3. This operation of transferringthe file data to the buffer memory 6 is performed in order to reduce thewait time of the host system 2 for the reason that a longer time isexpended on the write operation of the flash memory than on the readoperation thereof. At the step 201, the error information of the No. ofa block into which the file data are to be written is fetched from theerror information area 71 of the error memory 7. As in the case of theread operation, the error information is checked at the step 202. By wayof example, the block #1 has the error information “FFFFh” and istherefore the normal block, and the block #2 has the error information“0000h” and is therefore the abnormal block. When the file data are tobe written into the block #1, the routine proceeds to the step 203because of the normal block. In this case, the data of the block #1 ofthe data memory 8 are erased at the step 203, and the file data latchedin the buffer memory 6 are written into the block #1 of the data memory8 at the step 204. On the other hand, when the file data are to bewritten into the block #2, the routine proceeds to the step 205 becauseof the abnormal block. In this case, the data of the substitutive block#0 of the substitutive memory area 73 indicated by the value “0000h” ofthe error information is erased at the step 205, and the file data ofthe buffer memory 6 are written into the substitutive block #0 at thestep 206. Subsequently, whether the data have been normally written intothe data memory 8 or the error memory 7 is checked at the step 207. Awrite error develops in the flash memory in a case where the limit ofthe number of rewrite operations of this flash memory has been exceededdue to the frequent write operations of only a specified block. When thenormal write operation is decided at the checking step 207, the processof the file data writing instruction delivered from the host bus 3 isended. On the other hand, when the write operation is decided to beabnormal, the step 208 functions to update the error information and toallocate a substitutive block.

FIG. 5 illustrates the steps of the error process 208 mentioned above.The usage information of the usage information area 72 in the errormemory 7 is fetched at the step 209, and an unused substitutive block issought in view of the usage information at the step 210. It is seen fromFIG. 2 that the first thru fourth bits are “1's” signifying the usedstates of the corresponding substitutive blocks, and that the fifth bitis “0” signifying the unused state of substitutive block #4.Accordingly, the block which has undergone the write error issubstituted by the substitutive block #4. Therefore, the data of thesubstitutive block #4 are erased at the step 211 (since the blocksthemselves are variable in software fashion, any data might be stored inthe substitutive blocks), and the file data of the buffer memory 6 arewritten into the substitutive block #4 at the step 212. Subsequently,the error information of blocks having undergone write errors as storedin the error information area 71 are transferred to the buffer memory 6at the step 213. At the step 214, the error information latched in thebuffer memory 6 are rewritten into new error information. By way ofexample, in the case of the write error of the block 41, the value“FFFFh” of the address “00002h” is rewritten into the block No. “0004h”of the substitutive block #4. Further, the data of that block of theerror information area 71 which needs to be rewritten are erased at thestep 215, and the data of the buffer memory 6 are written into theoriginal block of the error information area 71 at the step 216.Likewise, the usage information of the usage information area 72 aretransferred to the buffer memory 6 at the step 217, and the bit of thesubstitutive block #4 to be newly used as a substitute this time isrewritten into “1” at the step 218. Subsequently, the data of the usageinformation area 72 are erased at the step 219, whereupon the data ofthe buffer memory 6 are written into the usage information area 72 atthe step 220. Owing to the error processing steps stated above, theerror block is replaced with the substitutive block, and the errorinformation is updated.

In the exemplified processing of this embodiment, only the check of thewrite operation is performed at the step 207 in FIG. 4. However, a checkconcerning if the block has been normally erased may well be added at astep succeeding the erase operation of each of the steps 203 and 205.Also in this case, the error process of the step 208 is performed.

Although the substitutive memory area 73 and the error information area71 are provided in the error memory 7 in this embodiment, they may wellbe formed by separate memory chips. On the contrary; an errorinformation area and a substitutive memory area may well be provided inthe data memory 8.

An architectural diagram in the latter case is illustrated in FIG. 6. Inthe second embodiment of FIG. 6, the error memory 7 is dispensed with,unlike the architecture of FIG. 1, so that the number of chips can bereduced.

FIG. 7 illustrates an example of the memory map of the data memory 8 ofthe embodiment in FIG. 6. As shown in FIG. 7, the data memory 8 isdivided into the four areas of an initialize information area 81, anerror information area 82, a substitutive memory area 83 and a data area84. The substitutive memory area 83 is the area which substitutes forthe blocks of the data area 84 having errors. The error information area82 stores therein the address information of the respective blocks ofthe data area 84, and the address information of substitutive blockscorresponding to the error blocks of the data area 82. Here, eachaddress information denotes the upper bits of the physical address orthe number of the physical block of the data memory 8. The initializeinformation area 81 is the area in which the start addresses and storagecapacities of the substitutive memory area 83, error information area 82and data area 84 are stored, and in which the address information of theunused blocks of the substitutive memory area 83 are also stored. Ininitializing the semiconductor disk storage device 1, the user thereofsets the depicted initialize information area 81. Thus, they can set thesize of the substitutive memory area 83 at will.

Now, the operation of this embodiment will be explained. First, FIG. 8illustrates the processing steps of the microcomputer 4 when thesemiconductor disk storage device 1 has received a read instruction fromthe host bus 3. It is assumed that the block number of the data area 84is delivered from the host bus 3. At the first step 300, themicrocomputer 4 fetches error information from the error informationarea 82. The address of the error information is obtained by acalculation based on the error information start address of theinitialize information area 81 and the block number afforded by the hostbus 3. By way of example, when the number of the block to be read out is“0”, the address of the error information is the first address of avalue “200h” which is obtained by multiplying the error informationstart address “0001” by 512. At the next step 301, a physical blockwhich corresponds to the error information fetched at the step 300 isread out. When the number of the block to be read out is “0”, the errorinformation is “200h”, so that data are read out of the address “4000h”of the data area 84 obtained by multiplying the value “200h” by 512.Besides, when the number of the block to be read out is “2”, the errorinformation is “100h”, so that data are read out of the address “2000h”of the substitutive memory area 83. In this manner, according to thisexample, the error information directly expresses the physical addressof the data memory 8. This example is therefore advantageous indispensing with the error check process of the step 101 unlike theexample shown in FIG. 3.

Next, there will be explained a case where the semiconductor diskstorage device 1 has received a write instruction from the host bus 3.FIG. 9 illustrates the processing steps of a write procedure. Datadelivered from the host bus 3 are latched into the buffer memory 6 atthe step 400. At the step 401, the error information of a block intowhich the data are to be written is fetched from the error informationarea 82 as in the read procedure. At the step 402, the physical addressof the data writing block is calculated from the fetched errorinformation, and the data of the block indicated by the physical addressare erased. At the next step 403, the data to-be-written latched in thebuffer memory 6 are written into that block of the data memory 8 whichis expressed by the physical address calculated at the step 402.Subsequently, whether or not the data have been normally written at thestep 403 is checked at the step 404. When the write operation is normal,the write process is ended, and when the write operation is not normal,an error process is executed at the step 405. In the error process 405,a substitutive block for the block having undergone a write error issecured so as to transfer the data to-be-written to the substitutiveblock, and the error information and the initialize information areupdated. Referring to FIG. 9 again, the unused address of thesubstitutive memory area 83 is fetched from the initialize informationarea 81 at the step 406. The value of the unused substitutive memoryaddress denotes the address of the new substitutive block. At the nextstep 407, the data of the substitutive block indicated by the unusedsubstitutive memory address are erased. In the example of FIG. 7, thedata of the block of an address “20800h” obtained by multiplying anaddress value “1104h” by 512 are erased. The data to-be-written latchedin the buffer memory 6 are written into the block of the address“20800h” at the step 408. Subsequently, the data of the blocks of theerror information having undergone the write errors are fetched from theerror information area 82 and then transferred to the buffer memory 6 atthe step 409. The transferred error information are updated to new errorinformation at the step 410. The update operation is such that,regarding the error which has developed in the case of writing the datainto block 10 by way of example, the error information “200h” of theblock 40 is rewritten into the address information “104h” of the newsubstitutive block. Further, the data of the block of the errorinformation area 82 to be rewritten are erased at the step 411, and thenew error information of the buffer memory 6 is written into the blockto-be-rewritten of the error information area 82 at the step 412.Besides, in order to update the address of the unused substitutive blockof the initialize information area 81, the data of the initializeinformation area 81 are transferred to the buffer memory 6 at the step413. Among the transferred initialize information, the unusedsubstitutive memory address has its value incremented by one at the step414. The resulting value serves as the address information of a newsubstitutive block at the next occurrence of a write error.Subsequently, the data of the initialize information area 81 are erasedat the step 415, and the updated initialize information of the buffermemory 6 are written into the initialize information area 81 at the step416. The write process including the error process is executed by thesteps stated above.

Although each of the substitutive memory area 83 and the data area 84 isformed of only one area in this example, a plurality of substitutivememory areas 83 and a plurality of data areas 84 may well be provided bysetting other address information and storage capacities anew in theinitialize information area 81.

As thus far described, in the semiconductor disk storage device whichemploys the flash memory as its storage medium, the errors attributableto the limited number of rewrite operations of the flash memory can beremedied, so that the service life of the semiconductor disk storagedevice can be extended.

Now, there will be explained methods of determining the storagecapacities of the substitutive memory areas 73, 83 and the errorinformation areas 71, 82 in the embodiments of FIGS. 1 and 2 and FIGS. 6and 7.

First, the storage capacity of the substitutive memory area 73 or 83depends upon the number of those blocks in the data memory 8 which thehost system 2 uses as areas to be rewritten most frequently, forexample, as FAT and directory areas. Here in this example, it is assumedthat a storage capacity of 128 kB is used as the FAT and directory areasin the data memory 8 of 32 MB. Herein, a storage capacity of 384 kB,triple the value 128 kB, is set for the substitutive memory area 73 or83, even the errors of the entire FAT and directory areas can bereplaced three times. Therefore, the service life of the semiconductordisk storage device 1 is quadrupled.

Thus, when the service life of the semiconductor disk storage device 1is to be prolonged n times, the substitutive memory area 73 or 83 may beendowed with a storage capacity which is (n−1) times as large as thetotal storage capacity of the areas that are frequently rewritten in thedata memory 8. In the case of the embodiment in FIG. 7, the substitutivememory area 83 has a storage capacity of 128 kB, and hence, the servicelife is doubled. In general, the FAT and directory areas are notentirely rewritten frequently, so that the service life is expected toincrease still more. However, the above setting is considered to be thestandard of the storage capacity of the substitutive memory area 73 or83.

Next, the storage capacity of the error information area 71 or 82 willbe studied. In the case of the embodiment in FIG. 1, an area for storingthe Nos. of the respective blocks of the substitutive memory area 73 isneeded in correspondence with the number of the blocks of the datamemory 8. Here in this example, the substitutive memory area 73 has 768blocks (384 kB), and the data memory 8 has 64 k blocks (32 MB).Therefore, the error information area 71 requires a capacity of, atleast, 80 kB for storing 10-bit address information expressive of the768 blocks to the number of 64 k.

On the other hand, in the case of the embodiment in FIG. 7, an area forstoring the numbers of the blocks of the substitutive memory area 83 orthe data area 84 is needed for the error information area 82 incorrespondence with the number of the blocks of the data area 84. Herein this example, the substitutive memory area 83 has 256 blocks, and thedata area 84 has 65024 blocks. Therefore, the error information area 82requires a capacity for storing 16-bit information expressive of theblock numbers up to the number of 65024.

The remaining storage capacity is assigned to the usage information area72 or the initialize information area 81.

In dividing the error memory 7 or the data memory 8 into the areas asstated above, it is conveniently partitioned into block units Which arethe rewriting units of the flash memory.

In this manner, according to the present invention, a storage capacityof 2% or less with respect to the full storage capacity of the flashmemory is used for the error information area 71 or 82 and thesubstitutive memory area 73 or 83, whereby the service life of thesemiconductor disk storage device 1 can be doubled or increased evenmore. Besides, when the service life is to be extended still more, thestorage capacity of the substitutive memory area 73 or 83 may beincreased, whereby the service life is prolonged to that extent.

Now, there will be explained the interface between the host system 2 andthe semiconductor disk storage device 1 in the first or secondembodiment. The host system 2 is an information processing equipmentsuch as personal computer or word processor. The host bus 3 is a bus towhich the host system 2 usually connects a file device such as magneticdisk storage device. In general, the host bus 3 for connecting themagnetic disk storage device is a SCSI (small computer system interface)or an IDE (Integrated drive engineering) interface. When thesemiconductor disk storage device 1 of the present invention isconnected to the host bus 3 of the SCSI, the IDE interface or the likesimilarly to the magnetic disk storage device, the conversion of themagnetic disk storage device to the semiconductor disk storage device 1is facilitated.

In order to connect the semiconductor disk storage device 1 to the SCSIor the IDE interface, the interface thereof needs to be made the same asthat of the magnetic disk storage device. To this end, first of all, thesize of each block of the flash memory must be brought intocorrespondence with that of each sector of the magnetic disk storagedevice. In the foregoing embodiments, the block size is set at 512bytes, which conforms to the sector size of the magnetic disk storagedevice. In a case where the block size is smaller than the sector sizeof the magnetic disk storage device, no problem is posed using aplurality of blocks as one sector. On the other hand, in a case wherethe block size is larger, one block needs to be divided into two or moresectors. In addition, regarding the tracks and headers of the magneticdisk storage device, the flash memory may be logically allotted to suchtracks and headers. Besides, the interface items of the semiconductordisk storage device 1, such as control registers and interrupts, aremade the same as those of the magnetic disk storage device, so as tocontrol the semiconductor disk storage device 1 by the input/outputinstructions of the magnetic disk storage device delivered from the hostbus 3. However, instructions peculiar to the magnetic disk storagedevice, for example, a process for the control of a motor, must beconverted into different processes.

Table 1 below exemplifies instructions for the magnetic disk storagedevice, the processes of the magnetic disk storage device responsive tothe instructions, and the processes of the semiconductor disk storagedevice 1 in the case where the instructions of the magnetic disk storagedevice are applied to the semiconductor disk storage device 1 as theyare. In the table, a column “Semiconductor disk process” indicates theprocesses which are executed when the microcomputer 4 functions as theacceptance means for accepting the instructions for the semiconductordisk storage device 1 and the conversion means for converting theinstructions.

The examples of Table 1 are of the IDE interface. In the table, theinstructions No. 1 and No. 6 are for moving the head. Herein, since thesemiconductor disk storage device 1 has no head, no process is executedin response to the instruction No. 1 or No. 6. Moreover, the flashmemory need not have any ECC (error correction code) set because theerror rate thereof is much lower than that of the magnetic disk storagedevice. Therefore, the semiconductor disk storage device 1 executes noprocess in response to the instruction “Read Verify Sector”. The otherinstructions are as listed in Table 1.

Incidentally, even in the case of no process indicated in Table 1, whenan interrupt or the like is issued in the magnetic disk storage device,an interrupt is similarly issued in the semiconductor disk storagedevice 1. That is, the interface is established so that the magneticdisk storage device and the semiconductor disk storage device 1 may notbe distinguished as viewed from the host bus 3.

As thus far described, the interface of the semiconductor disk storagedevice 1 is made the same as that of the magnetic disk storage device,whereby the replacement of the magnetic disk storage device with thesemiconductor disk storage device 1 is facilitated Regarding the SCSIinterface of the semiconductor disk storage device 1, the replacementcan be easily done by establishing the same interface as that of themagnetic disk storage device as in the case-of the IDE interface. Since,however, devices other than the magnetic disk storage device, such as amagnetooptic disk storage device, can be connected to the SCSIinterface, the file device has an individual instruction system,Accordingly, the semiconductor disk storage device 1 can also eliminateuseless processes and raise its operating speed when a dedicatedinstruction system is set therefor. Basically, however, the instructionsystem of the semiconductor disk storage device 1 is the same as that ofthe magnetic disk storage device, without a motor control command etc.In this case, the block size of the flash memory may be as desired, andone block of the flash memory may be processed as one sector. Besides,the processes of the microcomputer 4 and the processes of the flowcharts of FIGS. 3, 4 and 5 or FIGS. 8 and 9 as explained in theembodiment of FIG. 1 or FIG. 6 may well be executed by the host system2.

Meanwhile, the specifications of JEIDA (Japan Electronic IndustryDevelopment Association) and PCMCIA. (Personal Computer Memory CardInternational Association) are known as the standard specifications ofIC card interfaces. The semiconductor disk storage device 1 of thepresent invention may well be constructed in the form of an IC card withits interface conformed to the JEIDA or PCMCIA specifications. In thiscase, the semiconductor disk storage device 1 is dealt with as an I/Odevice.

The advantages of the semiconductor disk storage device 1 over themagnetic disk storage device are as follows: Since the semiconductordisk storage device 1 suffices with a smaller number of processes thanthe magnetic disk storage device as indicated in Table 1, it can beoperated at a higher speed. In addition, since the semiconductor diskstorage device 1 does not include mechanical parts such as a motor, thepower consumption thereof is lower. Besides, the semiconductor diskstorage device 1 exhibits a resistance to impacts concerning vibrationsetc. Moreover, owing to a high reliability, the semiconductor diskstorage device 1 does not require any ECC.

The use of the flash memory as the storage medium is based on thefollowing advantages: Since the flash memory is nonvolatile, it holdsdata even when the power supply is turned off, and it need not be backedup by a battery unlike an SRAM or DRAM. Further, since the flash memoryis structurally simple compared with an EEPROM, it can have its storagecapacity easily enlarged, and it is suited to mass production and can befabricated inexpensively.

In the present invention, the flash memory of a storage device may wellbe divided into a plurality of areas including a plurality of datamemory areas which store data therein and which are provided incorrespondence with the divisional areas, a plurality of substitutivememory areas which substitute for the data memory areas having undergoneerrors and which are provided in correspondence with the divisionalareas, a plurality of error memory areas which store the errorinformation of the data memory areas therein and which are provided incorrespondence with the divisional areas, and an initialize informationarea which stores the start addresses and storage capacities of thethree sorts of memory areas therein. According to this expedient, in acase where the data storing capacity of the storage device is to beenlarged by additionally providing one or more flash memory elements, itcan be enlarged by adding the three sorts of memory areas anew, withoutaltering the contents of the error memory areas and the data memoryareas stored before. The information of the added flash memory elementor elements may be stored in the initialize information area.

Besides, in the present invention, the error memory areas may well alsoretain the error information of the substitutive memory areas havingundergone errors. This expedient makes it possible to remedy, not onlythe errors of the data memory areas, but also the errors which havedeveloped in the substitutive memory areas having once substituted forthe data memory areas. The substitutive memory areas having undergonethe errors may be replaced in the same manner as in the case where theerrors have developed in the data memory areas. The replacements of thesubstitutive memory areas can extend the service life of the storagedevice.

Further, in the present invention, the storage capacity of thesubstitutive memory areas may be afforded by predetermined ones of thedata memory areas. As the predetermined areas, areas which are rewrittenmost frequently may be selected. Then, the service life of the storagedevice can be rendered much longer with a small number of substitutiveareas.

As set forth above, the present invention has the effect that theservice life of a semiconductor disk storage device employing a flashmemory as its storage medium can be extended.

Now, the third embodiment of the present invention will be describedwith reference to FIGS. 10, 11, 12 and 13. FIG. 10 is a diagram of thehardware architecture for realizing the third embodiment, FIG. 11 is adiagram showing the internal configuration of a flash memory chip foruse in this embodiment, FIG. 12 is a flow chart of the main routine ofstored data management, and FIG. 13 is a flow chart of an erasemanagement routine.

First, the operation of a flash memory will be explained with referenceto FIG. 11. In the figure, numeral 11 denotes the entire memory chip,numeral 12 a data reading unit, and numeral 13 the smallest unit of adata erasing operation, which shall be called the “erase block”. Theflash memory is a sort of EEPROM which is an electrically erasable PROM.However, whereas the ordinary EEPROM has a data reading unit and a dataerasing (rewriting) unit which are equal in size, the flash memory hasthe data erasing unit which is much larger than the data reading unit.In the flash memory, accordingly, the operation of rewriting data oncewritten is inevitably attended with erasing a large number of other dataat the same time. As an alternative advantage, however, the flash memorycan be manufactured at a density of integration higher than that of theordinary EEPROM, so that it is well suited to a large capacity storagedevice. Referring to FIG. 11, the entire memory chip 11 is divided intotwo or more erase blocks 13. Whereas the reading unit 12 is one word(the “word” is the word of the memory conforming to the construction ofthis memory), each of the erase blocks 13 is an area larger than thereading unit 12. In the case of applying the flash memory to anauxiliary storage, it is easily handled when the erasing unit is set at512 bytes in conformity with the specifications of a magnetic diskstorage device.

Next, the system architecture and operation of the third embodiment ofthe storage device employing the flash memory will be explained withreference to FIGS. 10, 12 and 13. In the ensuing description, thestoring unit of file data shall be called a “sector”, and one sectorshall be in agreement with one erase block in this embodiment. In FIG.10, numeral 21 denotes flash memory chips in which the file data arestored. An access controller (memory controller) 22 generates accesssignals which are directed to the flash memory 21. A processor 23 dealswith stored data and status data, and constructs an external storagesystem based on the flash memory 21. A program memory 24 stores thereincontrol programs for operating the processor 23. A logical sector table(logical sector reference means) 25 is for referring to the location ofthe flash memory 21 at which the data of a sector (logical sector)indicated by a certain logical address (logical sector identificationinformation) is mapped, while a physical sector table (physical sectorreference means) 26 is for referring to the logical sector No. of thefile data which is mapped at a physical sector indicated by the physicaladdress (physical sector identification information) of the flash memory21. A number of erasures management table (number of erasures referencemeans), 27 registers the cumulative numbers of erasures of a respectivephysical addresses. A status table (status reference means) 28 is forreferring to the statuses of the respective physical sectors. A writebuffer 29 serves to temporarily store data to-be-written therein, forthe purpose of quickening the operation of writing the data. Theprocessor 23 runs the programs stored in the program memory 24, tothereby function as logical sector conversion means, number of erasuresmanagement means and control means. Also, it retains sector pointers.

In operation, when an access request for reading data is received from asystem (client system) which issues access requests to the system ofthis embodiment, the processor 23 refers to the logical sector table 25to deduce a physical sector in which the data of a pertinent logicalsector is stored. Subsequently, the processor 23 accesses the physicalsector and transmits the requested data to the client system.

The processing of the processor 23 which complies with a request forwriting data as received from the client system, will be explained withreference to the flow chart of FIG. 12. This flow chart in FIG. 12 showsthe main routine of the programs stored in the program memory 24. Theprocessor 23 has a write pointer (sector pointer) set for pointing to asector into which the next data is to be written, and it checks if thesector pointed at by the pointer has a writable status, with referenceto the status table 28 (step (a)) The status table 28 contains a flagwhich indicates that the sector has degraded and is unusable due to alarge number of erasures, and a flag which indicates that data hasalready been written into the sector. When the flag is raised toindicate the unwritable status of the sector, the pointer is shifted tothe next sector (step (b)) Incidentally, the steps (a) and (b)correspond to the logical sector conversion means of the processor 23.On the other hand, when the sector is writable, the data is written intothe sector (step (c)). Herein, in a case where the write operation is torewrite a logical sector into a new sector into which data has neverbeen written, the data of the logical sector written before is no longernecessary. Therefore, a physical sector in which the unnecessary data iswritten is sought in view of the logical sector table 25, so as to erasethe data, while at the same time, the content of the physical sectortable 26 recorded in the last write operation is erased (step (d)).After the sector has been erased, the main routine jumps to an erasemanagement routine. This erase management routine (number of erasuresmanagement means) will be explained later. Further, a physical sectornumber indicated by the write pointer is recorded in the logical sectortable 25, and a logical sector number written into a location indicatedby the write pointer is recorded in the physical sector table 26 (step(e)).

Incidentally, at the step (a), the decision on the status of the sectormay well be recorded in the status table 28. The status of the sectorcan also be decided in view of the physical sector table 26. This statuscan be easily checked in such a way that all bits are set at H (highlevel) or L (low level) for an unwritten sector in the physical sectortable 26.

Next, the erase management routine mentioned above will be explainedwith reference to FIG. 13. The number of erasures counter of the erasemanagement table 27 corresponding to the physical sector from which thedata has been erased, is incremented by one (step (a)). If the number oferasures has not reached the prescribed number of times of the flashmemory, the erase management routine returns to the main routine, and ifit has reached the prescribed number of times, data is replaced (step(b)). In order to replace the data, all the other sectors of the numberof erasures management table 27 are examined to seek out the sectorwhich has the smallest number of erasures and whose data has not beenreplaced (step (c)). The data which is stored in the sought sectorexhibiting the smallest number of erasures is written into the sectorraised before (step (d)). After the data has been written, thereplacement flags of both the sectors are erected in the status table 28(step (e)). The replacement flags are set for the following reason: Thephysical sector which exhibits a smaller number of erasures comes to beerased more frequently by the erase management routine. Nevertheless, ifno means is provided for indicating the replacement, the physical sectorwill be selected as the object of the replacement on account of thesmaller number of erasures. Then, the numbers of erasures cannot beuniformalized for all the sectors. Besides, even the sector which has alarge number of erasures and into which the data is written on thisoccasion might be frequently erased without the means for indicating thereplacement. The replacement flags prevent such situations fromoccurring. After the replacement flags have been raised, thecorresponding contents of the logical sector table 25 and the physicalsector table 26 are rerecorded (step (f)).

Thereafter, the erase management routine returns to the main routine.Incidentally, the sector selected as having the smallest number oferasures is erased once more, so that the corresponding number oferasures counter of the erase management table 27 needs to beincremented.

In addition, when the replacement flags of all the sectors have beenraised, they are cleared. Alternatively, the logical decision levels ofthe replacement flags are inverted. That is, the replacements havingbeen decided with the level “1” shall be decided with the level “0”thenceforth.

Besides, the prescribed number of erasures at the step (b) in FIG. 13ought to be the multiple of a value which is smaller than the guaranteedvalue of the rewritable number of erasures of the flash memory. Forexample, when the guaranteed number of erasures is 10000, a suitableprescribed number of erasures is the multiple of 1000 or that of 2000 or5000.

Owing to the erase management routine, when the data of limited blockshave been frequently erased, they are replaced with the data of blocksexhibiting smaller numbers of erasures, whereby the data of the sectorserased less frequently are stored in the blocks exhibiting largernumbers of erasure's, so that the numbers of erasures can beuniformalized. This expedient is considered very effective for thestored data of ordinary auxiliary storages. By way of example, althoughdata are not rewritten at all in an area in which an operation systemprogram is stored, data are frequently rewritten in areas in which thegraphic data and text data to serve as the data of application programsare stored. Therefore, unless the numbers of erasures are uniformalized,the memory of the system program area does not degrade at all due to anincremented number of erasures because no data changes, whereas thememories of the other data areas are frequently erased in limited memoryspaces and rapidly increase the numbers of erasures. Thus, it can besaid that the erase management routine is especially effective when thenumber of the usable areas is small.

The third embodiment operates as stated above. This embodiment bringsforth the following effects: Since the processor 23 is mounted, finecontrols can be performed in accordance with the contents of the programmemory 24. Moreover, the speed of a data writing operation is heightenedowing to the write buffer 29, and the recording of the statuses ofindividual sectors is extended owing to the status table 28. Besides,since the service life of the flash memory is prolonged, the optimumfile administration in which the numbers of erasures are managed isrealized.

Now, the fourth embodiment of the present invention will be describedwith reference to FIGS. 14, 15, 16, 17 and 18. FIG. 14 is a diagramshowing the hardware architecture of the fourth embodiment, FIG. 15 is adiagram showing the internal storage configuration of a flash memory inthis embodiment, FIG. 16 is a flow chart of a main routine whichfunctions to write data, FIG. 17 is a flow chart of an arrangementroutine by which a sector storing unnecessary data therein is turnedinto an unwritten sector, and FIG. 18 is a flow chart of an erasemanagement routine which manages the numbers of erase operations.

First, the chip of the flash memory in this embodiment and a method ofusing this chip will be explained in conjunction with FIG. 15. In thefigure, numeral 52 indicates the unit of a storage area for storing filedata, the unit being the “sector” termed in the third embodiment.Numeral 53 indicates the smallest unit of a data erasing operation,which is called an “erase block” and which is constituted by a pluralityof sectors 52. That is, the storage capacities of the erase block 53 andthe sector 52 are unequal herein unlike those of the third embodiment.Shown at numeral 54 is the entire memory chip. Although the memory chip54 is constituted by a plurality of erase blocks 53 in the illustration,a chip constructed of one erase block is also considered.

This embodiment is applied to the memory chip in which the file data arestored in sector unit, but in compliance with a request for rewritingthe file data of a certain sector 52, also the other sectors of theerase block 53 are simultaneously erased.

Referring to FIG. 14 illustrative of the hardware architecture of thisembodiment, numeral 41 indicates the flash memory which forms storageareas for data to-be-written and which is constructed of a plurality ofmemory chips 54. An access controller 42 accesses the flash memory 41, aprocessor 43 deals with stored data and status data, and a programmemory 44 stores therein control programs for actuating the processor43. A physical sector table 45 is used for referring to logical sectorNos. stored in the corresponding physical sectors 52 of the flash memory41, while a logical sector table 46 records physical sector numberstherein for the purpose of referring to those physical sectors of theflash memory 41 in which the data of the stored logical sector numbersare respectively stored. Numeral 47 denotes an erase management table inwhich the numbers or erasures of the individual blocks are recorded,numeral 48 denotes a status table in which the statuses of theindividual blocks are recorded, and numeral 49 denotes anumber-of-written-sectors table which is used for referring to thenumbers of sectors in which data are already written. A write buffer(second storage means) 50 serves to temporarily hold the datato-be-written in order to heighten the speed of a data writingoperation, while an arrangement buffer (first storage means) 51 which isused when the arrangement routine in FIG. 17 is executed.

The operation of the fourth embodiment will be explained below. A readaccess is processed by referring to the logical sector table 96 and thephysical sector table 45 in the same manner as in the third embodiment.

On the other hand, a write access is processed as illustrated in FIG.16. First, a write pointer is set, and the status of a block pointed toby the write pointer is checked by referring to the status table 48(step (a)). The write pointer in this embodiment is a pointer set inblock units. When the block is broken, the pointer is shifted to thenext block (step (b)). When the checked block is not broken, the numberof written sectors of the block is checked by referring to thenumber-of-written-sectors table 49 (step (c)) Herein, when data arealready written in all the sectors of the checked block, the mainroutine jumps to the arrangement routine. This arrangement routine willbe explained later. On the other hand, when the checked block has anyunused sector, data is written into the sector (step (d)), and thecorresponding number of written sectors is incremented by one in thenumber-of-written-sectors table 49 (step (e)). Thus, by way of example,in a case where data was written into the third physical sector of thefirst block by the last write operation as viewed in FIG. 15, data iswritten into the fourth physical sector of the first block by the nextwrite operation. An actual write access control is performed by theaccess controller 42. In due course, data are written into all thesectors of the pertinent block. Then, the main routine jumps to thearrangement routine (step (f)). Insofar as the pertinent block is notfull, the sector numbers stored in the physical sector table 45 and thelogical sector table 46 are respectively rerecorded after the writeoperation (step (9)). Herein, when the write operation is to rewrite thedata of the logical sector written before, the logical sector numbersrecorded in the physical sector table 45 before is erased. Thisoperation of erasing the logical sector number serves to indicate thatthe data of the corresponding physical sector is invalid.

Next, the arrangement routine will be explained. This routine is anoperation routine which is executed when the block pointed to by thewrite pointer has had the data already written into all its sectors andis therefore unwritable. The reason why the arrangement routine isrequired, is as follows: According to the data writing method explainedabove, the data of the same file to be rewritten is written into aphysical sector different from the physical sector in which the data isstored. That is, the stored data becomes unnecessary before beingrewritten, but it is kept stored in the memory and is to be erased.However, in a case where the data is erased each time it becomesunnecessary, the flash memory which has a limited in the number of eraseoperations would have its service life shortened. Therefore, thearrangement routine is required. This arrangement routine is executedwhen the block has become full of the written data.

A concrete method of arrangement proceeds in accordance with the flowchart of FIG. 17. As illustrated in the figure, the physical sectortable 45 is first referred to, to check if the block to be arrangedincludes an erasable sector, namely, an unnecessary sector whose data isto be rewritten into another physical sector anew (step (a)).Subsequently, when no erasable sector exists, the arrangement routinereturns to the main routine. In contrast, when any erasable sectorexists, the block is re-arranged. On this occasion, data stored in theblock to be re-arranged are saved in the arrangement buffer 51 (step(b)), and the block to be re-arranged is erased (step (c)). After theblock has been erased, the arrangement routine jumps to the erasemanagement routine illustrated in FIG. 18 (step (d)). The erasemanagement routine will be explained later. At the next step, onlynecessary sectors among the sectors of the block to-be-arranged latchedin the arrangement-buffer 51 are re-written in this block (step (e)). Inthis regard, with the first scheme in which the necessary sectors arere-written in their original locations, the contents of the logicalsector table 46 and the physical sector table 45 need not be rerecorded.On the other hand, with the second scheme in which the necessary sectorsof younger sectors Nos. in the block are re-written earlier, data can beeasily written into the next new sector. The first or second scheme isselected as occasion arises. In the case of the second scheme, thecontents of the logical sector table 46 and the physical sector table 45need to be rerecorded. With either of the first and second schemes, thenumber of the re-written sectors needs to be recorded anew in thenumber-of-written-sectors table 49 (step (f)).

Next, the erase management routine will be explained in conjunction withthe flow chart shown in FIG. 18. Although the erase management routineis basically the same as that of the third embodiment, the formerdiffers from the latter in that erase operations are managed in blockunits, not in sector units. First, the number of erasures in the erasemanagement table 47 corresponding to the written block is incremented(step (a)). Whether or not the number of erasures of the erased blockhas reached a predetermined number, is subsequently checked (step (b)).When the predetermined number has been reached, the erase managementroutine is quit. On the other hand, when the predetermined number hasnot been reached, the numbers of erasures of all the blocks 53 of theflash memory chip 54 are checked so as to seek out the block exhibitingthe smallest number of erasures (step (c)). Herein, when the block ofthe smallest number of erasures does not agree with the arranged block,the data of the two blocks are replaced with each other (step (d)). Thearrangement data buffer 51 shown in FIG. 14 is utilized for thereplacement. Subsequently, the replacement flags of the blocks whosedata have been replaced are raised (step (e)). Further, the number oferasures counter of the erase management table 47 corresponding to theerased block is incremented, and the contents of the logical sectortable 46 and the physical sector table 45 are rerecorded (step (f)). Theabove is the operation of the erase management routine in thisembodiment.

Owing to the erase management routine, in the same manner as in thethird embodiment, when the data of limited blocks have been frequentlyerased, they are replaced with the data of blocks exhibiting smallernumbers of erasures, whereby the numbers of erasures of the blocks canbe uniformalized.

The fourth embodiment is operated as explained above. This embodimentbrings forth the effect that, when the erase block is too large as theunit of the data writing sector, it can be divided and used efficiently.

Incidentally, although the write buffer and the arrangement buffer areseparate in the illustrated embodiment, they may well be identical.

Now, the fifth embodiment of the present invention will be describedwith reference to FIGS. 19, 20 and 21. In this embodiment, a memory chiphas an erase block and a sector of equal storage capacities as in thethird embodiment, but it is used in a configuration illustrated in FIG.19. In the figure, numeral 91 indicates a superblock which isconstituted by a plurality of sectors. Since the units of the sector andthe erase block have equal sizes in this embodiment, the superblock 91in this embodiment is constituted by a plurality of erase blocks. As inFIG. 11 or FIG. 15, numeral 11 denotes the entire memory chip, numeral12 a data reading unit, and numeral 52 the sector.

The hardware architecture of the fourth embodiment is as illustrated inFIG. 20. In the figure, numeral 101 denotes an erase management table inwhich the number of erasures of the respective superblocks 91 arerecorded. As will be detailed later, it turns out that the cumulativenumber of erasures in the superblocks 91 are stored in the erasemanagement table 101. The other constituents of this embodiment in FIG.20 correspond to those denoted by the similar numerals in FIG. 10 orFIG. 14, respectively.

FIG. 21 is a flow chart of an erase management routine in thisembodiment. The main routine of this embodiment is similar to that ofthe third embodiment shown in FIG. 12. It is assumed that the processingof the main routine shall proceed as explained in connection with thethird embodiment, and the operation of this embodiment after the jump ofthe main routine to the erase management routine will be explained withreference to FIG. 21.

The number of erasures counter of the erase management table 101corresponding to the superblock 91 in which an erased sector isincluded, is incremented at the first step (step (a)). Whether or notthe number of erasures of the superblock 91 has reached a prescribedvalue, is subsequently decided (step (b)). When the prescribed number oftimes has not been reached, the, erase management routine returns to themain routine. On the other hand, when the prescribed number of erasureshas been reached, the numbers of erasures of all the superblocks 91 areexamined to seek out the superblock 91 which has the smallest number oferasures and whose data has not been replaced (step (c)). Subsequently,the data of the two superblocks 91 are replaced with each other (step(d)). Further, the replacement flags of both the superblocks 91 areraised (step (e)), and the contents of the relevant tables arererecorded (step (f)).

The merits of this embodiment are as stated below. In a memory whereindata can be erased in sector unit, erase operations are managed inplural-sector unit, thereby simplifying the erase management. Especiallyin rewriting a file of large storage capacity, there are attained theeffects that a wait time can be shortened and that the storage capacityof the erase management table 101 can be reduced. Accordingly, the fifthembodiment is suited to storage devices of large capacities in which itis difficult to manage the erase operations in sector units.

Now, the tables such as the logical sector table and the physical sectortable, which are the constituents of the embodiments described before,will be explained in more detail. The flash memory is a nonvolatilememory. It is accordingly natural that data in the flash memory are notlost even when the system of the present invention has its power supplycut off while it is not operating. However, when the contents of thetables are lost, the data saved in the flash memory becomeincomprehensible and meaningless data because the correspondingrelations of the data to sectors becomes unknown. Therefore, theinformation stored in the tables also needs to be obtained after thecutoff of the power supply. It is not necessary, however, to save allthe information in the tables. The information of the logical sectortable, for example, can be easily originated from the information of thephysical sector table. The converse is also possible. That is, theinformation of either of the tables may be saved.

Therefore, the physical sector table is stored in an electricallyerasable and programmable read-only memory (EEPROM) which isnonvolatile, while the logical sector table is originated from thephysical sector table by the processor at the start of the system atwhich the power supply is initiated. Thus, a volatile memory can beemployed as the logical sector table.

Likewise, the number-of-written-sectors table for respective blocks canbe originated from the physical sector table. It is therefore originatedin a volatile memory at the start of the system.

The tables mentioned above can also be developed in the main memory ofthe main system. The other tables are the erase management table and thestatus table, which cannot originate from any table. The erasemanagement table is stored in an EEPROM because the information thereofought not to be lost. The status table is obtained when data is writtenor erased once more, but this table should be stored in an EEPROM inorder to avoid repetitive trouble. For the purpose of saving a memorycapacity, however, it can be stored also in a volatile memory.

Regarding the storage media of the tables, the number of chips can alsobe reduced by storing the tables in an identical memory chip. By way ofexample, since both the physical sector table and the number of erasurestable ought to be stored in nonvolatile memories, they are stored in theidentical EEPROM chip. Then, only one EEPROM chip is necessary.

Besides, when the processor is implemented by a one-chip microcomputer,a table of comparatively small storage capacity, such as thenumber-of-written-sectors table, is stored in a RAM core which is builtinto the one-chip microcomputer.

The architecture of the sixth embodiment in which the above measuresconcerning the tables are collectively taken, is illustrated in FIG. 22.Referring to the figure, numeral ill indicates a one-chip microcomputer,in which a RAM core 112 and a ROM core 113 are built. Numeral 114denotes an EEPROM chip, and numeral 115 an SRAM or DRAM. This embodimentalso includes a flash memory 21 and an access controller 22 which arethe same as those explained before, respectively.

The number-of-written-sectors table is stored in the RAM core 112, whilecontrol programs for the microcomputer proper are stored in the ROM core113. The physical sector table and the erase management table are storedin the EEPROM 114, while the logical sector table is stored in the RAM115. In addition, the empty area of the RAM 115 is used as thearrangement buffer (51 in FIG. 14) in the case of executing thearrangement routine shown in FIG. 18 and the write buffer (50) forheightening the speed of a write operation.

In this manner, according to the sixth embodiment, the tables and thebuffers are collectively formed in accordance with the features of thestorage media, whereby the number of chips can be reduced.

Further, embodiments concerning the configuration of the flash memoryitself are illustrated in FIG. 23, FIG. 24 and FIG. 25.

The embodiment in FIG. 23 consists of a flash memory chip in which astorage area for tables, differing from a data area is provided in eraseblock unit. The management information of the physical sector table, thenumber of erasures management table, etc. of each corresponding blockare written into the table storing area, whereby the EEPROM can bedispensed with. In the figure, numeral 131 indicates an erase block, andnumeral 132 the table storing area additionally provided for every eraseblock 131. The information stored in the area 132 corresponding to theerase block 131 are made accessible by the same address as that of theerase block 131. Herein, the information in these tables are selected bythe signals of a signal line 133 being acceptance means, to thereby bedistinguished from the file data stored in the data area.

This expedient equalizes the service lives of the data area 131 and thetable area 132. That is, it can avoid a situation where the blockbecomes unusable because the table area 132 is broken in spite of theusable status of the data area 131. Such a tendency intensifies morewhen the data area 131 and the table area 132 are closer to each other.Moreover, since the tables are formed for every erase block 131, addresslines can be shared with ease.

Incidentally, the acceptance means may well receive information on modesso as to select the information of the tables.

The embodiment in FIG. 24 is such that a collective table area 132 isprovided separately from data areas 131, thereby dispensing with theEEPROM. This embodiment also attains the effect that, since memory cellsare gathered within a chip, they are simpler in construction than memorycells in FIG. 23.

The embodiment in FIG. 25 consists of a flash memory chip in which abuffer area 142 for latching data is provided separately from areas 141for storing data. The part 142 may well be a volatile memory. Numeral143 indicates an address counter which counts up in accordance withclock inputs. Shown at numeral 144 is transfer means functioning as bothfirst transfer means and second transfer means.

When a write access is received, the first transfer means writes datato-be-written into the buffer area 142. Besides, when an address isinput, the second transfer means transfers a plurality of items of datato the corresponding data area 141 at one stroke so as to be writtenthereinto. With such a memory, the write buffer which is externallymounted for heightening the speed of a write operation can be omitted.In a read operation, a plurality of items of data can be transferredcontrariwise from the data area 141 to the buffer area 142 at one strokeby inputting an address. Also, a read access is simplified.

In this case, the memory becomes more convenient in such a way that thebuffer area 142 is constructed as a serial access memory, making itunnecessary to apply successive addresses as inputs. Then, when theclock inputs are applied, the internal address counter 143 counts up,whereby the successive data areas 141 can be accessed to deliver thestored data.

It is most effective to construct the buffer area 142 in sector units.This buffer area is not restricted to one sector unit, but it caninclude a plurality of sector units in order to enhance the bufferingeffect thereof. By way of example, when one sector is an erase blockunit, the buffer area 142 whose capacity corresponds to one sector canwrite or read the data of one sector at a time. The buffer area 142whose capacity corresponds to a plurality of sectors can accept accessesfor writing the data of the plurality of sectors, and can prepare thedata of the plurality of sectors to-be-read-out. Further, this bufferarea 142 is effective to omit the arrangement buffer 51 which isexternally mounted.

The third embodiment et seq. of the present invention bring fortheffects as stated below.

In the data management scheme of an auxiliary storage employing a flashmemory which is limited in the number of erase operations, even whenspecified logical sector addresses are frequently rewritten, the samephysical storage areas are not used. Besides, when the number oferasures has increased in a certain area, the data of the area isreplaced with that of an area whose number of erasures is small, tothereby uniformalizing increases in the numbers of erasures. Therefore,the service life of the whole storage system is extended.

In addition, the number of data memory elements may correspond to anactual capacity for storing the file data of the system, and noredundant memory element is required.

Further, in a case where the memory is formed, not only with data areas,but also with an information holding area and a data buffer area, thenumbers of elements of peripheral circuits can be decreased to reducethe size of the whole system.

Many different embodiments of the present invention may be constructedwithout departing from the spirit and scope of the invention. It shouldbe understood that the present invention is not limited to the specificembodiments described in this specification. To the contrary, thepresent invention is intended to cover various modifications andequivalent arrangements included within the spirit and scope of theclaims.

1. A storage device, comprising: a flash memory chip electronicallyerasable in units of erasure blocks; and a controller for accessing tothe flash memory chip in response to an access from an external hostsystem, wherein the flash memory chip comprises a data area that storesdata corresponding to the access from the external host system and abuffer that temporally stores the data corresponding to the access fromthe external host system, wherein the buffer is different from the dataarea, and wherein a capacity of the buffer corresponds to a plurality ofthe erasure blocks.
 2. A storage device according to claim 1, whereinthe buffer is provided in the flash memory chip in place of anotherbuffer that is provided outside the flash memory chip.
 3. A storagedevice according to claim 1, wherein the flash memory chip transfers thedata from the buffer to the data area at a write access and transfersthe data from the data area to the buffer at a read access.
 4. A storagedevice according to claim 3, wherein the flash memory chip transfers thedata from the buffer to the data area according to an address inputthereto at the write access and transfers the data from the data area tothe buffer an address input thereto at the read access.
 5. A storagedevice according to claim 3, wherein the flash memory chip transfers aplurality of items of the data from the buffer to the data area togetherat the write access and transfers a plurality of items of the data fromthe data area together at the read access.
 6. A storage device accordingto claim 1, wherein the flash memory chip is accessible to successiveaddressees according to a clock input thereto without inputtingsuccessive addressees.
 7. A storage device according to claim 6, whereinthe flash memory chip further comprises: a address counter, and whereinthe flash memory chip counts up by the address counter to make thesuccessive addressees.
 8. A storage device according to claim 1, whereineach erasure block in the flash memory chip stores the data andconversion information between a logical address for the external hostsystem and a physical address for the flash memory chip.
 9. A storagedevice according to claim 1, wherein the buffer is a volatile memory.10. A storage device according to claim 1, wherein the flash memory chipis coupled to the controller via a bus.
 11. A storage device,comprising: a flash memory chip electronically erasable in units oferasure blocks; and a controller for accessing to the flash memory chipin response to an access from an external host system, wherein the flashmemory chip comprises a data area that stores data and a buffer thattemporally stores the data read out from the data area in response tothe read access from the external host system, wherein the buffer isdifferent from the data area, and wherein a capacity of the buffercorresponds to a plurality of the erasure blocks.
 12. A storage deviceaccording to claim 11, wherein the buffer is provided in the flashmemory chip in place of another buffer that is provided outside theflash memory chip.
 13. A storage device according to claim 11, whereinthe flash memory chip transfers the data from the buffer to the dataarea at a write access and transfers the data from the data area to thebuffer at the read access.
 14. A storage device according to claim 13,wherein the flash memory chip transfers the data from the buffer to thedata area according to an address input thereto at the write access andtransfers the data from the data area to the buffer an address inputthereto at the read access.
 15. A storage device according to claim 13,wherein the flash memory chip transfers a plurality of items of the datafrom the buffer to the data area together at the write access andtransfers a plurality of items of the data from the data area togetherat the read access.
 16. A storage device according to claim 11, whereinthe flash memory chip is accessible to successive addressees accordingto a clock input thereto without inputting successive addressees.
 17. Astorage device according to claim 16, wherein the flash memory chipfurther comprises: a address counter, and wherein the flash memory chipcounts up the address counter to make the successive addressees.
 18. Astorage device according to claim 11, wherein each erasure block in theflash memory chip stores the data and conversion information between alogical address for the external host system and a physical address forthe flash memory chip.
 19. A storage device according to claim 11,wherein the buffer is a volatile memory.
 20. A storage device accordingto claim 11, wherein the flash memory chip is coupled to the controllervia a bus.